<template>
  <div class="dashboard-container">
    <div class="main-content">
      <div class="left-column">
        <div class="panel elderly-stats">
          <div class="panel-header">
            <h3>长者统计</h3>
          </div>
          <div class="stats-grid">
            <div class="stat-item">
              <div class="stat-title">长者总数</div>
              <div class="stat-number">304</div>
              <div class="stat-detail">本年新增:79人</div>
              <div class="stat-detail">本月新增:7人</div>
            </div>
            <div class="stat-item">
              <div class="stat-title">低保长者</div>
              <div class="stat-number">203</div>
              <div class="stat-detail">本月新增:3人</div>
            </div>
            <div class="stat-item">
              <div class="stat-title">政府救助长者</div>
              <div class="stat-number">51</div>
              <div class="stat-detail">本月新增:1人</div>
            </div>
          </div>
        </div>
        <div class="panel age-distribution">
          <div class="panel-header">
            <h3>长者年龄分布</h3>
          </div>
          <XChart
            width="100%"
            height="300px"
            :option="state.ageDistributionOption"></XChart>
        </div>
        <div class="panel ability-assessment">
          <div class="panel-header">
            <h3>能力评估</h3>
          </div>
          <XChart
            width="100%"
            height="250px"
            :option="state.abilityAssessmentOption"></XChart>
        </div>
        <div class="panel living-situation">
          <div class="panel-header">
            <h3>居住情况</h3>
          </div>
          <XChart
            width="100%"
            height="250px"
            :option="state.livingSituationOption"></XChart>
        </div>
      </div>
      <div class="center-column">
        <div class="device-overview">
          <div class="device-stat">
            <div class="device-title">设备总数</div>
            <div class="device-number">290</div>
          </div>
          <div class="device-stat">
            <div class="device-title">在线设备</div>
            <div class="device-number online">221</div>
          </div>
        </div>
        <div class="map-panel">
          <XChart
            width="100%"
            height="400px"
            :option="{
              xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
              },
              yAxis: { type: 'value' },
              series: [
                { data: [150, 230, 224, 218, 135, 147, 260], type: 'line' }
              ]
            }"></XChart>
        </div>
      </div>
      <div class="right-column">
        <div class="panel device-stats">
          <div class="panel-header">
            <h3>设备统计</h3>
          </div>
          <div class="device-stats-content">
            <div class="device-stat-item">
              <span class="label"> 本月新增设备</span>
              <span class="value"> 290</span>
              <span class="sub-value"> 今日新增: 2</span>
            </div>
            <div class="device-stat-item">
              <span class="label"> 告警总数</span>
              <span class="value"> 2588</span>
              <span class="sub-value"> 已处理数: 200</span>
            </div>
          </div>
        </div>
        <div class="panel device-proportion">
          <div class="panel-header">
            <h3>设备占比</h3>
            <span class="date"> 2024.07.21</span>
          </div>
          <XChart
            width="100%"
            height="250px"
            :option="state.deviceProportionOption"></XChart>
        </div>
        <div class="panel real-time-monitoring">
          <div class="panel-header">
            <h3>实时智能监护</h3>
          </div>
          <div class="monitoring-icons">
            <div
              v-for="(item, index) in state.monitoringIcons"
              class="icon-item"
              :key="index">
              <XIcon :icon="item.icon" :size="24" :color="item.color"></XIcon>
              <div class="icon-number">
                {{ item.number }}
              </div>
            </div>
          </div>
          <div class="alert-list">
            <div
              v-for="(alert, index) in state.alerts"
              class="alert-item"
              :key="index">
              <div class="alert-time">
                {{ alert.time }}
              </div>
              <div class="alert-content">
                <span class="alert-name"> {{ alert.name }}</span>
                <span class="alert-desc"> {{ alert.description }}</span>
              </div>
            </div>
          </div>
        </div>
        <div class="panel service-stats">
          <div class="panel-header">
            <h3>服务统计</h3>
          </div>
          <div class="service-stats-grid">
            <div class="service-stat">
              <div class="service-number">41804</div>
              <div class="service-label">累计工单</div>
            </div>
            <div class="service-stat">
              <div class="service-number">221</div>
              <div class="service-label">今日工单</div>
            </div>
            <div class="service-stat">
              <div class="service-number">72</div>
              <div class="service-label">进行中</div>
            </div>
            <div class="service-stat">
              <div class="service-number">41744</div>
              <div class="service-label">已完成</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="bottom-row">
      <div class="panel community-types">
        <div class="panel-header">
          <h3>社区养老机构类型</h3>
        </div>
        <XChart
          width="100%"
          height="200px"
          :option="state.communityTypesOption"></XChart>
      </div>
      <div class="panel growth-trend">
        <div class="panel-header">
          <h3>长者增长趋势</h3>
        </div>
        <XChart
          width="100%"
          height="200px"
          :option="state.growthTrendOption"></XChart>
      </div>
      <div class="panel government-todo">
        <div class="panel-header">
          <h3>政务代办事项</h3>
        </div>
        <div class="todo-items">
          <div class="todo-item">
            <span class="todo-label"> 机构备案</span>
            <span class="todo-number"> 65</span>
          </div>
          <div class="todo-item">
            <span class="todo-label"> 等级评定</span>
            <span class="todo-number"> 24</span>
          </div>
          <div class="todo-item">
            <span class="todo-label"> 服务质量</span>
            <span class="todo-number"> 56</span>
          </div>
        </div>
      </div>
      <div class="panel activity-stats">
        <div class="panel-header">
          <h3>活动统计</h3>
        </div>
        <div class="activity-summary">
          <div class="activity-stat">
            <span class="stat-number"> 45</span>
            <span class="stat-label"> 活动总数</span>
          </div>
          <div class="activity-stat">
            <span class="stat-number"> 2</span>
            <span class="stat-label"> 进行中</span>
          </div>
          <div class="activity-stat">
            <span class="stat-number"> 5</span>
            <span class="stat-label"> 未开始</span>
          </div>
          <div class="activity-stat">
            <span class="stat-number"> 38</span>
            <span class="stat-label"> 已结束</span>
          </div>
        </div>
        <div class="activity-list">
          <div class="activity-item">
            <span class="activity-name"> 认知训练</span>
            <span class="activity-location"> 认知训练室</span>
            <span class="activity-date"> 2025/01/07 09:00</span>
            <span class="activity-status"> 进行中</span>
          </div>
        </div>
      </div>
      <div class="panel service-ranking">
        <div class="panel-header">
          <h3>服务排行</h3>
        </div>
        <XChart
          width="100%"
          height="200px"
          :option="state.serviceRankingOption"></XChart>
      </div>
      <div class="panel government-assistance">
        <div class="panel-header">
          <h3>政府救助统计</h3>
        </div>
        <XChart
          width="100%"
          height="200px"
          :option="state.governmentAssistanceOption"></XChart>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
  // @ts-nocheck
  import { defineComponent, reactive } from 'vue';
  import { XChart } from '@vtj/charts';
  import { XIcon } from '@vtj/ui';
  import {
    User,
    Bell,
    Clock,
    Warning,
    SuccessFilled,
    InfoFilled
  } from '@vtj/icons';
  import { useProvider } from '@vtj/renderer';
  export default defineComponent({
    name: 'Dsds',
    components: { XChart, XIcon },
    setup(props) {
      const provider = useProvider({ id: '196xrrax', version: '1755674060899' });
      const state = reactive({
        monitoringIcons: [
          { icon: User, number: 45, color: '#409EFF' },
          { icon: Bell, number: 87, color: '#67C23A' },
          { icon: Clock, number: 45, color: '#E6A23C' },
          { icon: Warning, number: 65, color: '#F56C6C' },
          { icon: SuccessFilled, number: 1068, color: '#909399' },
          { icon: InfoFilled, number: 158, color: '#409EFF' }
        ],
        alerts: [
          { time: '09:30', name: '刘*保', description: '尿湿告警' },
          { time: '09:15', name: '刘*保', description: '下肢康复训练' }
        ],
        ageDistributionOption: {
          tooltip: { trigger: 'axis' },
          legend: { data: ['男', '女'], textStyle: { color: '#fff' } },
          grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
          xAxis: { type: 'value', axisLine: { lineStyle: { color: '#fff' } } },
          yAxis: {
            type: 'category',
            data: [
              '100以上',
              '90-99岁',
              '80-89岁',
              '70-79岁',
              '60-69岁',
              '60岁以下'
            ],
            axisLine: { lineStyle: { color: '#fff' } }
          },
          series: [
            {
              name: '男',
              type: 'bar',
              data: [5, 15, 25, 35, 45, 10],
              itemStyle: { color: '#409EFF' }
            },
            {
              name: '女',
              type: 'bar',
              data: [8, 20, 30, 40, 50, 12],
              itemStyle: { color: '#E6A23C' }
            }
          ]
        },
        abilityAssessmentOption: {
          tooltip: { trigger: 'item' },
          legend: {
            orient: 'vertical',
            right: 10,
            top: 'center',
            textStyle: { color: '#fff' }
          },
          series: [
            {
              type: 'pie',
              radius: ['40%', '70%'],
              data: [
                { value: 20, name: '能力较好', itemStyle: { color: '#67C23A' } },
                { value: 10, name: '轻度失能', itemStyle: { color: '#E6A23C' } },
                { value: 10, name: '中度失能', itemStyle: { color: '#F56C6C' } },
                { value: 30, name: '重度失能', itemStyle: { color: '#909399' } },
                { value: 20, name: '中重度失能', itemStyle: { color: '#409EFF' } }
              ],
              label: { show: true, formatter: '{b}: {d}%' }
            }
          ]
        },
        livingSituationOption: {
          radar: {
            indicator: [
              { name: '独居', max: 100 },
              { name: '与配偶居住', max: 100 },
              { name: '与子女居住', max: 100 },
              { name: '与父母居住', max: 100 },
              { name: '与兄弟姐妹居住', max: 100 },
              { name: '与其他亲属居住', max: 100 }
            ],
            splitLine: { lineStyle: { color: 'rgba(255,255,255,0.3)' } },
            axisLine: { lineStyle: { color: 'rgba(255,255,255,0.5)' } }
          },
          series: [
            {
              type: 'radar',
              data: [
                {
                  value: [65, 70, 60, 45, 30, 25],
                  name: '居住情况',
                  areaStyle: { color: 'rgba(64, 158, 255, 0.6)' },
                  lineStyle: { color: '#409EFF' }
                }
              ]
            }
          ]
        },
        deviceProportionOption: {
          tooltip: { trigger: 'item' },
          series: [
            {
              type: 'pie',
              radius: ['40%', '70%'],
              data: [
                { value: 30, name: '方便', itemStyle: { color: '#409EFF' } },
                { value: 10, name: '上下床', itemStyle: { color: '#67C23A' } },
                { value: 5, name: '未动', itemStyle: { color: '#E6A23C' } },
                { value: 20, name: '洗澡', itemStyle: { color: '#F56C6C' } },
                { value: 15, name: '吃饭', itemStyle: { color: '#909399' } },
                { value: 20, name: '穿衣', itemStyle: { color: '#8E44AD' } }
              ],
              label: { show: true, formatter: '{b}: {d}%' }
            }
          ]
        },
        communityTypesOption: {
          tooltip: { trigger: 'item' },
          series: [
            {
              type: 'pie',
              radius: ['40%', '70%'],
              data: [
                {
                  value: 30,
                  name: '日间照料数量',
                  itemStyle: { color: '#409EFF' }
                },
                {
                  value: 10,
                  name: '养老院数量',
                  itemStyle: { color: '#67C23A' }
                },
                {
                  value: 60,
                  name: '服务中心数量',
                  itemStyle: { color: '#E6A23C' }
                }
              ],
              label: { show: true, formatter: '{b}: {d}%' }
            }
          ]
        },
        growthTrendOption: {
          tooltip: { trigger: 'axis' },
          grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
          xAxis: {
            type: 'category',
            data: ['一月', '二月', '三月', '四月', '五月', '六月'],
            axisLine: { lineStyle: { color: '#fff' } }
          },
          yAxis: { type: 'value', axisLine: { lineStyle: { color: '#fff' } } },
          series: [
            {
              name: '长者数',
              type: 'line',
              data: [250, 270, 290, 280, 300, 304],
              itemStyle: { color: '#409EFF' },
              lineStyle: { color: '#409EFF' }
            }
          ]
        },
        serviceRankingOption: {
          tooltip: { trigger: 'axis' },
          grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
          xAxis: { type: 'value', axisLine: { lineStyle: { color: '#fff' } } },
          yAxis: {
            type: 'category',
            data: ['助医', '助浴', '助急', '助洁', '助餐'],
            axisLine: { lineStyle: { color: '#fff' } }
          },
          series: [
            {
              type: 'bar',
              data: [120, 80, 60, 100, 150],
              itemStyle: { color: '#409EFF' }
            }
          ]
        },
        governmentAssistanceOption: {
          radar: {
            indicator: [
              { name: '定期抚恤补助', max: 100 },
              { name: '城镇"三无"', max: 100 },
              { name: '农村"五保"', max: 100 },
              { name: '失独', max: 100 }
            ],
            splitLine: { lineStyle: { color: 'rgba(255,255,255,0.3)' } },
            axisLine: { lineStyle: { color: 'rgba(255,255,255,0.5)' } }
          },
          series: [
            {
              type: 'radar',
              data: [
                {
                  value: [80, 60, 70, 50],
                  name: '政府救助',
                  areaStyle: { color: 'rgba(103, 194, 58, 0.6)' },
                  lineStyle: { color: '#67C23A' }
                }
              ]
            }
          ]
        }
      });
      return {
        state,
        props,
        provider,
        User,
        Bell,
        Clock,
        Warning,
        SuccessFilled,
        InfoFilled
      };
    }
  })
</script>
<style lang="css" scoped>
  .dashboard-container {
    background: linear-gradient(135deg, #0c0e29 0%, #1a1f4b 100%);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
    font-family: 'Microsoft YaHei', sans-serif;
  }
  /* 顶部导航栏样式 */
  .top-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
  }
  .nav-left,
  .nav-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .date,
  .time {
    font-size: 14px;
    color: #a0a0a0;
  }
  .tabs {
    display: flex;
    gap: 15px;
  }
  .tab {
    padding: 5px 12px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
  }
  .tab:hover,
  .tab.active {
    background: #409eff;
    color: #fff;
  }
  .header-title {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .logo {
    border-radius: 8px;
  }
  .header-title h1 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(45deg, #409eff, #67c23a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  /* 主内容区域样式 */
  .main-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
  }
  .left-column,
  .right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .center-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  /* 面板通用样式 */
  .panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #409eff;
  }
  /* 长者统计面板样式 */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
  .stat-item {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
  }
  .stat-title {
    font-size: 12px;
    color: #a0a0a0;
    margin-bottom: 5px;
  }
  .stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #409eff;
    margin-bottom: 5px;
  }
  .stat-detail {
    font-size: 12px;
    color: #67c23a;
  }
  /* 设备概览样式 */
  .device-overview {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
  }
  .device-stat {
    text-align: center;
  }
  .device-title {
    font-size: 14px;
    color: #a0a0a0;
    margin-bottom: 5px;
  }
  .device-number {
    font-size: 28px;
    font-weight: bold;
    color: #409eff;
  }
  .device-number.online {
    color: #67c23a;
  }
  /* 地图面板样式 */
  .map-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    height: 600px;
  }
  .map-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  /* 设备统计样式 */
  .device-stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
  .device-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
  }
  .label {
    font-size: 14px;
    color: #a0a0a0;
  }
  .value {
    font-size: 18px;
    font-weight: bold;
    color: #409eff;
  }
  .sub-value {
    font-size: 12px;
    color: #67c23a;
  }
  /* 实时监控样式 */
  .monitoring-icons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 15px;
  }
  .icon-item {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
  }
  .icon-number {
    font-size: 16px;
    font-weight: bold;
    margin-top: 5px;
  }
  .alert-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .alert-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 12px;
  }
  .alert-time {
    color: #a0a0a0;
    margin-right: 10px;
    min-width: 40px;
  }
  .alert-name {
    color: #409eff;
    margin-right: 5px;
  }
  .alert-desc {
    color: #fff;
  }
  /* 服务统计样式 */
  .service-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  .service-stat {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
  }
  .service-number {
    font-size: 20px;
    font-weight: bold;
    color: #409eff;
    margin-bottom: 5px;
  }
  .service-label {
    font-size: 12px;
    color: #a0a0a0;
  }
  /* 底部行样式 */
  .bottom-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
  }
  .bottom-row .panel {
    min-height: 250px;
  }
  /* 代办事项样式 */
  .todo-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
  }
  .todo-label {
    font-size: 14px;
    color: #a0a0a0;
  }
  .todo-number {
    font-size: 16px;
    font-weight: bold;
    color: #409eff;
  }
  /* 活动统计样式 */
  .activity-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
  }
  .activity-stat {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
  }
  .stat-number {
    font-size: 16px;
    font-weight: bold;
    color: #409eff;
    display: block;
  }
  .stat-label {
    font-size: 12px;
    color: #a0a0a0;
    display: block;
  }
  .activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 12px;
  }
  .activity-name {
    color: #409eff;
    font-weight: bold;
  }
  .activity-location {
    color: #a0a0a0;
  }
  .activity-date {
    color: #fff;
  }
  .activity-status {
    color: #67c23a;
    font-weight: bold;
  }
</style>
